package service;

import model.SC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class ScoreService {
    private ScoreDao dao;
    @Autowired
    public void setScoreDao(ScoreDao dao){
        this.dao=dao;
    }
    public boolean deleteScore(String cno,String sno){
        return dao.deleteScore(cno,sno)>0;
    }
    public ArrayList<SC> getScore(String cno, String sno){
        return dao.findScoreByCnoAndSno(cno,sno);
    }
    public ArrayList<SC> getScore_sno(String sno){
        return dao.findScoreBySno(sno);
    }
    public ArrayList<SC> getScore_cno(String cno){
        return dao.findScoreByCno(cno);
    }
    public ArrayList<SC> getAllScores(){
        return dao.getAllScores();
    }
    public boolean editScore(SC score){
        return dao.editScore(score)>0;
    }
    public boolean addScore(SC score){
        return  dao.addScore(score)>0;
    }
}
